<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>
<%--<jsp:include page="../../head.jsp"/>--%>
<title>缓存清理 - 云超市</title>
<style type="text/css">
    	td{
    		text-align: center;
    	}
    	.row11{
    		margin-top: 40px;
    	}
      .tishiP{
        text-align: center;;
        color: red;
      }
      .row12{
        margin-top: 10px;
      }
    </style>
<div class = "row row11" >
   		 	<div class="col-sm-3 col-xs-0"></div>
   		 	<div class="col-sm-4 col-xs-8">
   		 		   <input type="text" class="form-control" id="inputEmail3" placeholder="请输入关键词">
   		 	</div>
   		 	<div class="col-sm-4 col-xs-4">
   		 		<button class="btn btn-info  btn-sm" id="cBtn" onclick="clearCache()">清除缓存</button> 
   		 	</div>
   		 	</div> 

        <div class = "row row12" >
        <div class="col-sm-3"></div>
        <div class="col-sm-4">
             <div class="tishiP hide" id="tishiP"></div>
        </div>
     
        </div> 
   		</div>

<script type="text/javascript">
	var clearCache = function() {
	    hideInfo();
	    var pattern = $("#inputEmail3").val();
	    var value = $.trim(pattern);
	    
	    if (value=="") {
	      showInfo("请输入关键词");
	      return;
	    }
	
	    var $cBtn = $("#cBtn");
	    $cBtn.html("正在清除...");
	    $cBtn.attr("onclick" , "showInfo('正在清除，请等候')");
		var pattom = {pattom: value}
	    $.ajax({
	      url : "${contextPath}/sys/clouderp/cleanCache",
	      dataType : "json",
	      type : "post",
            data: pattom,
	      success : function(data) {
	        $cBtn.attr("onclick" , "clearCache()");
	        $cBtn.html("清除缓存");
	        showInfo(data.message);
	      },
	      error : function(error){
	        $cBtn.attr("onclick" , "clearCache()");
	        $cBtn.html("清除缓存");
	        showInfo("服务器异常");
	      }
	    });
	  }
	
	  var showInfo = function(info){
	    var tishiP = $("#tishiP");
	    tishiP.removeClass("hide");
	    tishiP.html(info);
	  }
	
	  var hideInfo = function(){
	     var tishiP = $("#tishiP");
	    tishiP.addClass("hide");
	  }
 </script>